package com.ali.controller;

import com.ali.common.Response;
import com.ali.dto.OrderInfo;
import com.ali.service.OrderService;
import jakarta.annotation.Resource;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.Map;

@Slf4j
@RestController
@RequestMapping("/order")
public class OrderController {
    @Resource
    private OrderService orderService;

    /**
     * 查询
     */
    @GetMapping(value = "/query")
    public Response<OrderInfo> query(@RequestParam Map<String, Object> param) {
        return orderService.query(param);
    }

    /**
     * 获取服务信息
     */
    @GetMapping(value = "/nacos/service/info")
    public Response<Map<String, Object>> getServerInfo(@RequestParam Map<String, Object> param) {
        return orderService.getServiceInfo(param);
    }

    /**
     * 获取配置信息
     */
    @GetMapping(value = "/nacos/config/info")
    public Response<String> getConfigInfo(@Value("${content.info}") String info) {
        return orderService.getConfigInfo(info);
    }
}
